<?php
require_once("Validator.php");

class NoEmptyValidator extends Validator {
	
	public function __construct($fieldName, $value, $errorMessage) {
		parent::__construct($fieldName, $value, $errorMessage);
	}
	
	/**
	 * Checks if a string is a valid email address.
	 *
	 * @return NULL if the field is valid, a ValidationError if field is null or 
	 * 		   empty
	 */
	public function validate() {
		
		if ( $this->value==null || (trim($this->value)=="") ) {
			return new ValidationError($this->fieldName, $this->value, 
									   $this->errorMessage);
		} else {
			return null;
		}
	}
}

?>